﻿using GoogleMusicAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MetaMusicNet
{
    public class MusicCollection
    {
        private List<GoogleMusicSong> _songs;
        public List<GoogleMusicSong> songs { get { return _songs; } set { _songs = value; } }

        public Dictionary<string, int> genreCounts { get { return _genreCounts; } set { _genreCounts = value; } }
        private Dictionary<string, int> _genreCounts;

        public HashSet<string> names { get { return _names; } set { _names = value; } }
        private HashSet<string> _names;

        public MusicCollection()
        {
            _songs = new List<GoogleMusicSong>();
            _genreCounts = new Dictionary<string, int>();
            _names = new HashSet<string>();
        }

        public void addSongs(List<GoogleMusicSong> songs)
        {
            foreach(GoogleMusicSong s in songs)
            {
                if(!_names.Contains(s.Name+s.Artist))
                {
                    _names.Add(s.Name+s.Artist);
                    _songs.Add(s);
                    if(_genreCounts.ContainsKey(s.Genre))
                    {
                        _genreCounts[s.Genre]=++genreCounts[s.Genre];
                    }
                    else
                    {
                        _genreCounts.Add(s.Genre,1);
                    }
                }
            }
        }
        //cleanGenreCount()


        
        
    }
}
